package exam_20210713.examTest02;

/**
 * @author Xiao
 * @date 2021/7/13
 */

/**
 * 汽车类
 */
public class Car {
    /**
     * 定义一个汽车类(Car类)，定义三个属性：品牌(brand),价格(price),颜色(color)，
     * 定义构造方法，定义get、set方法。
     */
    private String brand;
    private int price;
    private String color;

    /*
    //  重写toString()
        @Override
        public String toString() {
            return "Car{" +
                    "brand='" + brand + '\'' +
                    ", price=" + price +
                    ", color='" + color + '\'' +
                    '}';
        }
    */
    public Car() {
    }

    public Car(String brand, int price, String color) {
        this.brand = brand;
        this.price = price;
        this.color = color;
    }

    public String getBrand() {
        return brand;
    }

    public void setBrand(String brand) {
        this.brand = brand;
    }

    public int getPrice() {
        return price;
    }

    public void setPrice(int price) {
        this.price = price;
    }

    public String getColor() {
        return color;
    }

    public void setColor(String color) {
        this.color = color;
    }
}
